package daily.oct;

public class lc812 {
    public double largestTriangleArea(int[][] points) {
        double MaxArea = 0;
        int len = points.length;
        for (int i = 0; i < len; i++) {
            for (int j = i + 1; j < len; j++) {
                for (int k = j + 1; k < len; k++) {
                    int x1=points[i][0];
                    int y1=points[i][1];
                    int x2=points[j][0];
                    int y2=points[j][1];
                    int x3=points[k][0];
                    int y3=points[k][1];

                    double tmpA=x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2);
                    tmpA=Math.abs(tmpA);

                    if(tmpA>MaxArea){
                        MaxArea = tmpA;
                    }
                }
            }
        }

        //System.out.println("MaxArea = " + MaxArea);
        double ans=MaxArea/2;
        return ans;
    }

    public static void main(String[] args) {
        int[][] points = new int[][]{{0,0},{0,1},{1,0},{0,2},{2,0}};
        lc812 l = new lc812();
        System.out.println(l.largestTriangleArea(points));
    }
}
